<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
  <meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" href="<%=path%>/images/favicon.ico" type="image/ico">
<meta name="author" content="guowenjie">
<link href="<%=path%>/css/bootstrap.min.css" rel="stylesheet">
<link href="<%=path%>/css/materialdesignicons.min.css" rel="stylesheet">
<link href="<%=path%>/css/style.min.css" rel="stylesheet">
<link rel="stylesheet" href="<%=path%>/js/ion-rangeslider/ion.rangeSlider.min.css">
<link href="<%=path%>/js/jconfirm/jquery-confirm.min.css" rel="stylesheet">
<link href="<%=path%>/js/bootstrap-datepicker/bootstrap-datepicker3.min.css" rel="stylesheet">
<link href="<%=path%>/js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="<%=path%>/css/materialdesignicons.min.css" rel="stylesheet">
<link rel="stylesheet" href="<%=path%>/style/layui/css/layui.css">

<script type="text/javascript" src="<%=path%>/js/jquery.min.js"></script>
 <script type="text/javascript" src="<%=path%>/js/main.min.js"></script>
<script src="<%=path%>/js/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script src="<%=path%>/js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/bootstrap-table/bootstrap-table.js"></script>
<script type="text/javascript" src="<%=path%>/js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="<%=path%>/js/jconfirm/jquery-confirm.min.js"></script>
<script type="text/javascript" src="<%=path%>/style/layui/layui.js"></script>

</head>
 <body style="background:#FFF">
    
         <div class="row">
         
         <div id="toolbar" class="toolbar-btn-action">
            
            <div class="input-group">
                  <input type="text" class="form-control" id="gjz" placeholder="请输入法规关键字">
                  <span class="input-group-btn">
                  <button class="btn btn-default" type="button" onclick="search()">查询</button>
                   </span>
                </div>
            </div>
        
          <div class="col-md-12">
           <table id="table" ></table>
        </div>
          
          <div style="display:none">
          <input type="text"  id="type"></input>
           <input type="text"  id="wjname"></input>
        
          <input type="text"  id="wjcode"></input>
         </div>
            
        </div>
        
    
     
      
      <div class="modal fade bs-example-modal-lg" tabindex="-1" id="edital" role="dialog" data-backdrop="static" data-keyboard="false" aria-labelledby="myModalLabel">
            <div class="modal-dialog modal-lg" role="document">
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                  <h4 class="modal-title" id="myModalLabel">编辑</h4>
                </div>
                <div class="modal-body">
               <form id="form2"> 
                    <div class="form-group">
                      <label for="recipient-name" class="control-label">主题：</label>
                      <input type="text" class="form-control" name="allists.Altitle" id="EAltitle">
                      <input type="hidden" class="form-control" name="allists.Alid" id="EAlid">
                    </div>
                    <div class="form-group">
                      <label for="recipient-name" class="control-label">关键词：</label>
                      <input type="text" class="form-control" name="allists.Algjz" id="EAlgjz">
                    </div>
                    <div class="form-group">
                      <label for="message-text" class="control-label">变更内容：</label>
                      <textarea class="form-control" rows="5" name="allists.Bgnr" style="resize: none;" id="EBgnr"></textarea>
                    </div>
                    <div class="form-group">
                      <label for="message-text" class="control-label">研究内容：</label>
                      <textarea class="form-control" rows="5" name="allists.Bgzd" style="resize: none;" id="EBgzd"></textarea>
                    </div>
                  </form>
                </div>
                <div class="modal-footer">
                  <button type="button"  class="btn btn-primary">点击保存</button>
                </div>
              </div>
            </div>
          </div>
        </body>
       <script type="text/javascript">
   
	     	    
             
      
	     	    
	     	    
           
	     	 
      
 
       
       $('#table').bootstrapTable({
    	   classes: 'table table-condensed table-hover',
    		data:[],
    		toolbar: '#toolbar',       // 工具按钮容器	
    	    dataType : 'json',        // 因为本示例中是跨域的调用,所以涉及到ajax都采用jsonp,
    	    pagination: true,                    // 是否显示分页
    	    pageNumber: 1,                       // 初始化加载第一页，默认第一页
    	    pageSize: 10,                        // 每页的记录行数
    	    sidePagination: "client",            // 分页方式：client客户端分页，server服务端分页
    	    columns: [{
  		         checkbox: true    // 是否显示复选框
  		     },{
    	        field: 'Alid',
    	        title: '案例序号',
    	        width:20
    	        ,
               
               formatter: function (value, row, index) {
               	 var result;
               	 let a = 1;
               	 a = a + index;
               	 result ='<a style="color:black">'+a+'</a>';
               	 return result;
               }
    	    },{
    	        field: 'Altitle',
    	        title: '案例标题',
    	        align: 'center'
    	    },{
    	        field: 'operate',
    	        title: '查看详情',
    	        formatter: btnGroup,  // 自定义方法
    	        events: {
    	            'click .edit-btn': function (event, value, row, index) {
    	            	window.parent.title = "案例分享";
    	            	let html = "<h3 style='font-size:17' align='center'>"+row.Altitle+"</h3>";
    	            	html = html + "<h3 style='font-size:17'>变更内容:</h3>";
    	            	var snsArr=row.Bgnr.split("\r\n");
    	            	for(var a=0;a<snsArr.length;a++){
    	            		html = html + "<p style='font-size:13'>"+snsArr[a]+"</p>";	
    	            	}
    	            	html = html + "<h3 style='font-size:17'>研究内容:</h3>";
                    let fd = row.Bgzd.split("￥￥");
    	            	
    	            	snsArr=fd[0].split("\r\n");
    	            	for(var a=0;a<snsArr.length;a++){
    	            		html = html + "<p style='font-size:13'>"+snsArr[a]+"</p>";	
    	            	}
    	            	if(fd.length>1){
    	            	html = html + "<h3 style='font-size:17'>特别关注:</h3>";	
    	            	snsArr=fd[1].split("\r\n");
    	              for(var a=0;a<snsArr.length;a++){
    	            		html = html + "<p style='font-size:13'>"+snsArr[a]+"</p>";	
    	            	}
    	               }
    	            	
    	            	window.parent.nrbody = html;
    	            	window.parent.test(); 
                   	   	
    	            }
    	        }
    	    }],
    	 
    	    onLoadSuccess: function(data){
    	        $("[data-toggle='tooltip']").tooltip();
    	    }
    	});

    	search();
    	function search(){
    	$.ajax({
    		 type: "post",//方法类型
    	   dataType: "json",//预期服务器返回的数据类型 jsonp跨域
    		url: "<%=path%>/bg/getaldata",
    		data:{
    			"Algjz":$("#gjz").val()
    		}, 
    		success: function(req) {	
    			let data = req.data;
    			$("#table").bootstrapTable('refreshOptions',{data:data});	 
    		},error: function(e){ 
    			console.log(e);
    			
    		}
    	});
    	}



    	// 操作按钮
    	function btnGroup ()
    	{
    	    let html ='<a href="#!" class="btn btn-xs btn-default m-r-5 edit-btn" title="查看" data-toggle="tooltip"><i class="mdi mdi-eye"></i></a>';
    	    return html;
    	}
    	
    	
    	function del(){
     	   let row=$("#table").bootstrapTable('getSelections');     
     	   if(row.length==0){
     		   $.alert({
     	        title: '提示',
     	        content: "请选择要操作的数据"})
        	    }else{
        	    	let fgids = new Array();
         		for(var a=0;a<row.length;a++){
         			
         			fgids.push(row[a].fgid);	
         		}
         		
         		$.ajax({
   	   			 type: "post",//方法类型
   	   		    dataType: "json",//预期服务器返回的数据类型 jsonp跨域
   	   			url: "<%=path%>/bg/delfgwj",
   	   			data:{
   	   				"fgids":fgids.join(",")
   	   			}, 
   	   			success: function(req) {
   	   		    $.alert({
             	        title: '提示',
             	        content: '操作成功',
             			buttons: {
             				confirm: {
             					text: '确认',
             					btnClass: 'btn-primary',
             					action: function(){
             						search();
             					}
             				}
             			}
             	    });
    	   				 
   	   			},error: function(e){ 
   	   			 console.log(e.responseText);	
   	   			}
   	   		});
         		
        	    }
        }
       
      </script>
       </body>

</html>   